[PATCH] coredump: use %d in kernel core pattern
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 29 Apr 2025 12:47:59 +0000 (14:47 +0200)
committerArnaud Rebillout <arnaudr@debian.org>
Mon, 13 Apr 2026 07:18:40 +0000 (14:18 +0700)
commit1faef9dbb33cad727f48479e6993fdb0153b1116
treeb50edaf1b7e97a3da4ec949750adc2a9eb6bd1f6
parent339034b921e657fc9f8e7511555984fa5c74b67c
[PATCH] coredump: use %d in kernel core pattern

The kernel provides %d which is documented as
"dump mode—same as value returned by prctl(2) PR_GET_DUMPABLE".

We already query /proc/pid/auxv for this information, but unfortunately this
check is subject to a race, because the crashed process may be replaced by an
attacker before we read this data, for example replacing a SUID process that
was killed by a signal with another process that is not SUID, tricking us into
making the coredump of the original process readable by the attacker.

With this patch, we effectively add one more check to the list of conditions
that need be satisfied if we are to make the coredump accessible to the user.

Reportedy-by: Qualys Security Advisory <qsa@qualys.com>
(cherry-picked from commit 0c49e0049b7665bb7769a13ef346fef92e1ad4d6)
(cherry-picked from commit c58a8a6ec9817275bb4babaa2c08e0e35090d4e3)
(cherry picked from commit 19d439189ab85dd7222bdd59fd442bbcc8ea99a7)
(cherry picked from commit 254ab8d2a7866679cee006d844d078774cbac3c9)
(cherry picked from commit 7fc7aa5a4d28d7768dfd1eb85be385c3ea949168)
(cherry picked from commit 19b228662e0fcc6596c0395a0af8486a4b3f1627)

Origin: upstream, https://github.com/systemd/systemd-stable/commit/2eb46dce078334805c547cbcf5e6462cf9d2f9f0
Forwarded: not-needed
Last-Update: 2025-06-23

Gbp-Pq: Name CVE-2025-4598-4.patch
src/coredump/coredump.c
sysctl.d/50-coredump.conf.in
test/units/testsuite-74.coredump.sh [new file with mode: 0755]